#include <iostream>
#include <string>
class Student
{
public:
    Student(int age, const std::string &name)
    {
        m_age = age;
        m_name = name;
        std::cout << "Student调用构造函数\n";
    }
    Student()
    {
        std::cout << "无参构造函数\n";
    }
    Student(const std::string &name)
    {
        m_name = name;
    }
#if 0
    Student(const Student &s)
    {
        std::cout << "调用拷贝构造函数\n";
        m_age = s.m_age;
        m_name = s.m_name;
    }
#endif
#if 0
    void operator=(const Student &s)
    {
        std::cout << "赋值运算符的重载\n";
        m_age = s.m_age;
        m_name = s.m_name;
    }
#endif
    void setAge(int age);
    int getAge();
    void setName(const std::string &name);
    std::string getName();
    ~Student()
    {
        std::cout << "Student调用析构函数\n";
    }

private:
    int m_age;
    std::string m_name;
};

/*类内声明*/
/*类外定义*/
void Student::setAge(int age)
{
    m_age = age;
}
int Student::getAge()
{
    return m_age;
}
void Student::setName(const std::string &name)
{
    m_name = name;
}
std::string Student::getName()
{
    return m_name;
}
void func(Student s)
{
}

int main()
{
#if 0
    Student stu(10, "zhangsan");
    // stu.setAge(10);
    // stu.setName("zhangsan");
    Student stu1(stu);
    // Student stu1 = stu;//拷贝构造
    Student stu2;
    stu2 = stu;
#endif
    Student *stu = new Student(11, "张三");
    std::cout << "stu:" << stu->getAge() << std::endl;
    std::cout << "stu:" << stu->getName() << std::endl;
    delete stu;
    // std::cout << "stu1:" << stu1.getAge() << std::endl;
    // std::cout << "stu1:" << stu1.getName() << std::endl;
    // std::cout << "stu2:" << stu2.getAge() << std::endl;
    // std::cout << "stu2:" << stu2.getName() << std::endl;
    return 0;
}